package cn.wangyu.msblogadmin.common.result;

/**
 * @author wangyu
 * @version 1.0
 * @date 2021/4/11 19:06
 */
public enum ResponseCode {
    SUCCESS(200, "success"),
    FAILED(500, "failed"),
    NOT_AUTHORIZED(401, "未授权"),

    /**
     * 参数异常 4001-4099
     */
    REQUEST_PARAM_MISMATCH(4001, "请求参数类型不匹配"),
    REQUEST_PARAM_MISSING(4002, "请求参数缺失"),
    REQUEST_NOT_FOUND(4004, "请求地址不存在"),
    REQUEST_METHOD_NOT_SUPPORTED(4005, "请求方法不支持"),
    REQUEST_PARAM_EMPTY(4006, "请求参数内容为空"),

    /**
     * 服务器内部异常 5000-5099
     */
    ERROR(5000, "服务器报错"),
    NULL_POINTER(5001, "服务器报错，空指针"),
    ILLEGAL_ARGUMENT(5002, "服务器报错，非法参数"),

    /**
     * 用户信息错误 5101-5199
     */
    USER_NOT_LOGIN(5101, "用户未登录，访问路径需要登录验证验证"),
    USER_LOGIN_ERROR(5102, "账号或密码错误"),
    USER_ACCOUNT_FORBIDDEN(5103, "账号被禁用"),
    USER_NOT_EXIST(5104, "用户不存在"),
    USER_HAS_EXISTED(5105, "用户已存在"),
    USER_NOT_ROLES(5106, "用户角色信息异常"),
    USER_FORBIDDEN_ACCESS(5107, "用户角色信息异常"),
    USER_OLD_PASSWORD_ERROR(5108, "用户旧密码匹配错误"),
    USER_PASSWORD_MISMATCH(5109, "用户旧密码匹配错误");

    private Integer code;
    private String desc;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ResponseCode(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
